/*!
 * @author Stéphane LaFlèche <stephane.l@vanillaforums.com>
 * @copyright 2009-2019 Vanilla Forums Inc.
 * @license GPL-2.0-only
 */

// Break Points
$richEditor-mobile_spacing: 18px !default;
$richEditor-mobileBreakPoint: 700px !default;

@mixin defaultTransition($properties...) {
    transition-property: $properties;
    transition-duration: 0.15s;
    transition-timing-function: ease-out;
}

@mixin customCubicBezier($startA, $endA, $startB, $endB) {
    transition-timing-function: cubic-bezier($startA, $endA, $startB, $endB);
}

@mixin generateStylesFromMap($map) {
    @each $property, $value in $map {
        #{$property}: $value;
    }
}

@mixin generateButtonClass($buttonMap, $useZIndex: false) {
    & {
        @include generateStylesFromMap(map-get($buttonMap, "default"));
    }

    &:not([disabled]) {
        &:hover {
            @include generateStylesFromMap(map-get($buttonMap, "hover"));

            @if $useZIndex {
                z-index: 2;
            }
        }

        &:active {
            @include generateStylesFromMap(map-get($buttonMap, "focus"));

            @if $useZIndex {
                z-index: 1;
            }
        }
    }
}

@mixin ieHack {
    // IE 10 and 11 only
    @media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {
        @content;
    }
}

@mixin objectFitWithFallback() {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    height: auto;
    width: 100%;
    @supports (object-fit: cover) {
        object-fit: cover;
        object-position: center;
        height: 100%;
    }
}

.accessibility-jumpTo {
    @include resetButton;
}

// Rich Editor
@mixin mediaQuery-richEditor_mobile {
    @media (max-width: $richEditor-mobileBreakPoint) {
        @content;
    }
}

@mixin mediaQuery-richEditor_notMobile {
    @media (min-width: #{$richEditor-mobileBreakPoint}) {
        @content;
    }
}
